# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Fabian Bornschein <fabiscafe-cat-mailbox-dog-org>

pkgname=gnome-initial-setup
pkgver=43.2
pkgrel=1
pkgdesc='Simple, easy, and safe way to prepare a new system'
arch=('loong64' 'x86_64')
url='https://gitlab.gnome.org/GNOME/gnome-initial-setup'
license=('GPL')
depends=('cheese' 'gdm' 'gnome-online-accounts' 'ibus' 'malcontent' 'libgweather-4'
         'libnm' 'libnma-gtk4' 'librest' 'geocode-glib-2' 'webkit2gtk-5.0')
makedepends=('meson')
options=('debug')
source=("https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz")
sha256sums=('23d7963a54d49594504d0eacd85096cafb5f86f1e74a58e040675b6e798ae698')

build() {
  arch-meson $pkgname-$pkgver build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "${pkgdir}"
  install -d -o root -g 102 -m 750 "$pkgdir/usr/share/polkit-1/rules.d"

  # Setup system user and group
  echo 'u gnome-initial-setup - "GNOME Initial Setup" /run/gnome-initial-setup' |
    install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
  echo 'd /run/gnome-initial-setup 0700 gnome-initial-setup gnome-initial-setup -' |
    install -Dm644 /dev/stdin "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
}
